package tmall.portal.utils;

import tmall.framework.exception.FrameworkExceptionDict;
import tmall.framework.exception.TException;

import java.util.Collection;

public class ArgumentUtil {
    public static void isEmpty(Object o) {
        if (o == null) {
            throw new TException(FrameworkExceptionDict.PARAMS_NOT_EXIST);
        } else if (o instanceof Collection) {
            Collection obj = (Collection) o;
            if (obj.isEmpty()) {
                throw new TException(FrameworkExceptionDict.PARAMS_NOT_EXIST);
            }
        } else if (o instanceof String) {
            String obj = (String) o;
            if (obj.isEmpty()) {
                throw new TException(FrameworkExceptionDict.PARAMS_NOT_EXIST);
            }
        }
    }
}
